package test;

import com.fuxian.dao.UserMapper;
import com.fuxian.entity.User;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

/**
 * Created by fusxian on 14-3-19.
 */
public class test01 {
    public  static  void main(String[] args) throws  Exception
    {
        String resource= "configuration.xml";
        SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(Resources.getResourceAsReader(resource));
        SqlSession session = sessionFactory.openSession();
        UserMapper userMapper = session.getMapper(UserMapper.class);
        User user= userMapper.findById(23);
        System.out.println(user);
    }
}
